<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <meta charset="UTF-8">
    <title>Thymeleaf in action</title>
</head>
<body>
<div th:fragment="header">
    <h1>Thymeleaf in action</h1>
    <a href="/users" th:href="@{~/users}">首页</a>
    <div sec:authorize="isAuthenticated()">
        <p sec:authentication="name"></p>
        <form action="/logout" th:action="@{/logout}" method="post">
            <input type="submit" value="退出"/>
        </form>
    </div>
    <div sec:authorize="isAnonymous()">
        <a href="/login" th:href="@{~/login}">登录</a>
    </div>
</div>
</body>
</html>